﻿using EFCore.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SIService;
using SService;

namespace WMSWeb.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class InboundSController : ControllerBase
    {
        private readonly WmssystemContext myDb;
        private readonly InboundS inbound;

        public InboundSController(WmssystemContext myDb, SService.InboundS  inbound)
        {
            this.myDb = myDb;
            this.inbound = inbound;
        }
        /// <summary>
        /// 4个条件分页查询
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<List<PO_Inbound>> Fye(int pageSize, int currentPage, string Number=null, string Type = null, string Status = null, string WName = null)
        {
           
            return await inbound.Fye(pageSize, currentPage,  Number, Type,Status,WName);
        }
        [HttpGet]
        public async Task<List<PO_Inbound>> Qu()
        {
            return await inbound.Qu();
        }
        /// <summary>
        /// 查询进货订单和供应商表
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<List<PO_Purchaseorders>> Jhqu()
        {
            return await inbound.Jhqu();
        }
        /// <summary>
        /// 入库管理添加数据
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> Add(PO_Inbound pO_Inbound)
        {
            return await inbound.Add(pO_Inbound);
        }
        /// <summary>
        /// 入库管理,进货订单入库
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpPut]
        public async Task<int> Upd(PO_Purchaseorders pO_Purchaseorders)
        {
            return await inbound.Upd(pO_Purchaseorders);
        }
        /// <summary>
        /// 入库管理批量删除
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpDelete]
        public async Task<int> RkDel(List<int> Ids)
        {
            return await inbound.RkDel(Ids);
        }
        /// <summary>
        /// 入库管理审核
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpPut]
        public async Task<int> RkShen(PO_Inbound pO_Inbound, string to)
        {
            return await inbound.RkShen(pO_Inbound, to);
        }
        /// <summary>
        /// 入库管理修改
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpPut]
        public async Task<int> Upd1(PO_Inbound pO_Inbound)
        {
            return await inbound.Upd1(pO_Inbound);
        }
    }
}
